/*****************************************************************************************
HT1621控制要点：
1)由公共输出口COM0-COM3和段输出口SEG0-SEG23控制LCD的段码; 
2)3个关键数据口: 
  a)CS:片选,低电平有效; 
  b)WR:读写控制,上升沿从MCU读取数据; 
  c)DATA:数据,命令是大端位序,数据是小端位序; 
3)命令结构:3bit标识(LCD_FLAG_CMD)+9bit命令 
4)写数据到RAM:3bit标识(LCD_FLAG_DATA)+6bit地址+若干bit数据(数据是小端) 

*****************************************************************************************/
#include "..\Inc\includes.h"

/**************************************************************************
 * 函数名		：HT1621_MSB_WriteData()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：写数据函数,cnt为传送数据位数,数据传送为高位在前
 *************************************************************************/		

void HT1621_MSB_WriteData(unsigned char u8_data, unsigned char u8_cnt)
{
	unsigned char i;

	for (i=0; i<u8_cnt; i++)
	{
		HT1621_WR_Bit = 0;
		HT1621_DATA_Bit = u8_data&0x80;
		NOP();
		HT1621_WR_Bit = 1;
		u8_data <<= 1;
		NOP();
		NOP();
	}
}

/**************************************************************************
 * 函数名		：HT1621_LSB_WriteData()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：写数据函数,cnt为传送数据位数,数据传送为低位在前
 *************************************************************************/		

void HT1621_LSB_WriteData(unsigned char u8_data, unsigned char u8_cnt)
{
	unsigned char i;

	for (i=0; i<u8_cnt; i++)
	{
		HT1621_WR_Bit = 0;
		HT1621_DATA_Bit = u8_data&0x01;																													//
		NOP();
		HT1621_WR_Bit = 1;
		u8_data >>= 1;
		NOP();
		NOP();
	}
}

/**************************************************************************
 * 函数名		：HT1621_WriteData()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：HT1621命令写入函数
 *						cmd为写入命令数据,写入命令标识位100
 *************************************************************************/		
void HT1621_Write_CMD(unsigned char u8_command)
{
 HT1621_CS_Bit = 0;
 HT1621_MSB_WriteData(0x80,4); 																														//写入3位命令标志100,到最后一位位命令的最高位，因为最高位不用所直接写0
 HT1621_MSB_WriteData(u8_command,8); 																											//写入8位命令数据，最高位写0了
 HT1621_CS_Bit = 1;
}

/**************************************************************************
 * 函数名		：HT1621_WriteOneData()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：HT1621在指定地址写入数据函数
 *						addr为写入初始地址，data为写入数据,
 *						因为HT1621的数据位4位，所以实际写入数据为参数的后4位
 *************************************************************************/	
void HT1621_WriteOneData(unsigned char u8_addr, unsigned char u8_data)
{
	HT1621_CS_Bit = FALSE;
	HT1621_MSB_WriteData(0xA0,3); 																													//写入数据标志101
	HT1621_MSB_WriteData(u8_addr,6); 																													//写入地址的高6位
	HT1621_LSB_WriteData(u8_data,4); 																													//写入数据的低4位
	HT1621_CS_Bit = TRUE;
}

/**************************************************************************
 * 函数名		：HT1621_WriteAllData()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：HT1621连续写入方式函数
 *						addr为写入初始地址，*p为连续写入数据指针,cnt为写入数据总数
 *						HT1621的数据位4位，此处每次数据为8位，写入数据总数按8位计算
 *************************************************************************/	
void HT1621_RefreshScreenDisplay(unsigned char *p)
{
	unsigned char 										i;

	HT1621_CS_Bit = FALSE;
	HT1621_MSB_WriteData(HT1621_DATA,3); 																										//写入数据标志101
	HT1621_MSB_WriteData(0x00, 6);//((u8_addr<<2),6); 																			//写入地址的高6位,因为是全屏刷新所有写入首地址00.
	for (i=0;i<16;i++)
	{
		HT1621_LSB_WriteData(*(p+i),8); 																											//写入数据的低4位
	}
	HT1621_CS_Bit = TRUE;
}

/**************************************************************************
 * 函数名		：HT1621_ClearAllScreen()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：HT1621连续写入方式清屏
 *						HT1621的数据位4位，此处每次数据为8位，写入数据总数按8位计算
 *************************************************************************/	
void HT1621_ClearAllScreen(void)
{
	unsigned char 										i = 0;

	HT1621_CS_Bit = FALSE;
	HT1621_MSB_WriteData(HT1621_DATA,3); 																										//写入数据标志101
	HT1621_MSB_WriteData(0x00,6); 																													//写入地址的高6位
	for (;i<16;i++)																																					//连续写操作，每次写完结束地址会自动加1
	{
		HT1621_LSB_WriteData(0x00,8); 																												//写入数据0到低4位
	}
	HT1621_CS_Bit = TRUE;
}

/**************************************************************************
 * 函数名		：HT1621_ClearAllScreen()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：HT1621连续写入方式清屏
 *						HT1621的数据位4位，此处每次数据为8位，写入数据总数按8位计算
 *************************************************************************/	
void HT1621_ShowAllScreen(void)
{
	unsigned char 										i = 0;

	HT1621_CS_Bit = FALSE;
	HT1621_MSB_WriteData(HT1621_DATA,3); 																										//写入数据标志101
	HT1621_MSB_WriteData(0x00,6); 																													//写入地址的高6位
	for (;i<16;i++)																																					//连续写操作，每次写完结束地址会自动加1
	{
		HT1621_LSB_WriteData(0xFF,8); 																												//写入数据0到低4位
	}
	HT1621_CS_Bit = TRUE;
}

/**************************************************************************
 * 函数名		：HT1621_Init()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2017-09-15
 * 函数描述 ：初始化后，液晶屏所有字段均显示
 *************************************************************************/		
void HT1621_Init(void)
{		
	HT1621_CS_Bit = TRUE;
	HT1621_WR_Bit = TRUE;
	HT1621_DATA_Bit = TRUE;
	HT1621_Write_CMD(HT1621_BIAS_AND_COM);																									//设置偏压和COM口数量
	HT1621_Write_CMD(HT1621_INTERNAL_OSC); 																									//使用内部振荡器
	HT1621_Write_CMD(SYSTEM_DISABLE);																												//先关闭系统时钟
	HT1621_Write_CMD(HT1621_WDT_DISABLE);																										//不使用看门狗
	HT1621_ShowAllScreen();																																	//点亮所以段码
	HT1621_Write_CMD(SYSTEM_ENABLE);																												//打开HT1621系统时钟
	HT1621_Write_CMD(LCD_DISPLAY_ON);																												//开LCD显示
	DelayForWork(1000);																																			//延时1秒
	HT1621_ClearAllScreen();																																//清屏
}

/**************************************************************************
 * 函数名		：DigitalDisplayCharge()
 * 输入参数 ：display_value_charge
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2012-10-06
 * 函数描述 ：数码管显示值转换
 *************************************************************************/
 void DigitalDisplayCharge(unsigned int u16_display_vlaue_charge)
 {		
		U8_DisplayTenThousand= u16_display_vlaue_charge/10000;																//万位显示数字
		U8_DisplayThousand = u16_display_vlaue_charge%10000/1000;															//千位显示数字
		U8_DispalyHundred = u16_display_vlaue_charge%1000/100;																//百位显示数字
		U8_DisplayTen = u16_display_vlaue_charge%100/10;																			//十位显示的数字
		U8_DisplayUnit = u16_display_vlaue_charge%10;																					//个位显示的数字
 }
 
 /*****************************************************************************************
 * 函数名		：LCD_SetDisplayData
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2018-09-08
 * 函数描述 ：LCD显示设置
 ****************************************************************************************/
 void LCD_SetDisplayData(void)
 {
		unsigned char							u8_speed_show_buffer = 0;
		unsigned int							u16_function_show_buffer = 0,
															u16_battery_voltage_buffer = 0;
		
		static unsigned char			u8_set_flash_count = 0;
//----------------------------------------------------------------------------------------//	
//先做准备将用到的段码都当作不显示，后面如果要显示就置位就可以了，	
		LCD_COM0_DIS_Flag = LOW_LEVEL;																												//关DIS标识
		LCD_COM1_ODO_Flag = LOW_LEVEL;																												//关ODO标识
		LCD_COM0_U1_Flag = LOW_LEVEL;																													//关小数点			
		LCD_COM0_VOL_Flag = LOW_LEVEL;																												//关电压标识
		LCD_COM0_SET_Flag = LOW_LEVEL;																												//关“SET”标识
		LCD_COM0_MPH_Flag = LOW_LEVEL;																												//关“MPH”标识
		LCD_COM1_KMH_Flag = LOW_LEVEL;																												//关“KMH”标识		
		LCD_COM2_T6_Flag = LOW_LEVEL;																													//关转把故障标识	
		LCD_COM3_T5_Flag = LOW_LEVEL;																													//关电机故障标识
		LCD_COM3_T4_Flag = LOW_LEVEL;																													//关刹车标识
		LCD_SetNumber(SEGMENT_DISPLAYS_5, LCD_Code[CHARACTER_BLANK]);													//不显示万位
		
		u16_battery_voltage_buffer = BatteryVoltageCalculate();																//得到修正计算后的电压值
//----------------------------------------------------------------------------------------//
				
		if (FunctionSetFlag)																																	//进入设置状态就显示“SET”标识
		{
			LCD_COM0_SET_Flag = HIGH_LEVEL;
			SleepTimeFlag = FALSE;																															//设置下禁止休眠功能
			ParameterAdjustment();																															//
			u8_speed_show_buffer = U8_FunctionMenuIndex;																				//显示菜单索引
			u16_function_show_buffer = U16_ParameterValueShowIndex;															//功能区显示的值
			
			if ((u8_set_flash_count++)>4)																												//在设置状态下功能区数码管闪烁400毫秒亮一次
			{
				FunctionSetFlashFlag = ~FunctionSetFlashFlag;
				u8_set_flash_count = 0;
			}	
			
		}
		else																																									//工作模式
		{
			FunctionSetFlashFlag = FALSE;
//----------------------------------------------------------------------------------------//
//里程单位选择			
			if (KMH_OR_MPH_Flag)																																//计算时速单位为MPH
			{
				LCD_COM0_MPH_Flag = HIGH_LEVEL;																										//开“MPH”标识
			}
			else																																								//计算时速单位为KMH
			{
				LCD_COM1_KMH_Flag = HIGH_LEVEL;																										//开“KMH”标识
				u8_speed_show_buffer = U8_SpeedDisplay;																						//
			}
//----------------------------------------------------------------------------------------//
//			
			if (U8_DIS_ODO_VOL_Index==0)																												//单次里程
			{
				LCD_COM0_U1_Flag = HIGH_LEVEL;																										//开小数点
				LCD_COM0_DIS_Flag = HIGH_LEVEL;																										//开DIS标识
				u16_function_show_buffer = U16_DistanceNumber;
			}
			else if (U8_DIS_ODO_VOL_Index==1)																										//总里程
			{
				LCD_COM1_ODO_Flag = HIGH_LEVEL;																										//开ODO标识
				LCD_SetNumber(SEGMENT_DISPLAYS_5, LCD_Code[U8_DisplayTenThousand]);								//总里程显示万位
				u16_function_show_buffer = U16_OdographNumber;
				
			}
			else if (U8_DIS_ODO_VOL_Index==2)																										//电压
			{
				LCD_COM0_U1_Flag = HIGH_LEVEL;																										//开小数点
				LCD_COM0_VOL_Flag = HIGH_LEVEL;																										//开电压标识
				u16_function_show_buffer = u16_battery_voltage_buffer;
			}
			else																																								//默认为单次里程
			{
				U8_DIS_ODO_VOL_Index = 0;
			}
			
		//	if (U8_DIS_ODO_VOL_Index==1)																												//如果是总里程就显示万位
				
		}
//----------------------------------------------------------------------------------------//		
		DigitalDisplayCharge(u8_speed_show_buffer);																						//转换时速区数码管显示值
		LCD_SetNumber(SEGMENT_DISPLAYS_1, LCD_Code[U8_DisplayTen]);														//显示时速区数码管十位
		LCD_SetNumber(SEGMENT_DISPLAYS_2, LCD_Code[U8_DisplayUnit]);													//显示时速区数码管个位
		LCD_SetNumber(SEGMENT_DISPLAYS_3, LCD_Code[U8_Gear_State]);														//显示时速区数码管个位
		DigitalDisplayCharge(u16_function_show_buffer);																				//转换功能区数码管显示值	
		
		if (FunctionSetFlashFlag)
		{
			LCD_SetNumber(SEGMENT_DISPLAYS_6, LCD_Code[CHARACTER_BLANK]);                      	//消隐功能区数码管千位
			LCD_SetNumber(SEGMENT_DISPLAYS_7, LCD_Code[CHARACTER_BLANK]);                       //消隐功能区数码管百位
			LCD_SetNumber(SEGMENT_DISPLAYS_8, LCD_Code[CHARACTER_BLANK]);                       //消隐功能区数码管十位
			LCD_SetNumber(SEGMENT_DISPLAYS_9, LCD_Code[CHARACTER_BLANK]);												//消隐功能区数码管个位
		}
		else
		{
			LCD_SetNumber(SEGMENT_DISPLAYS_6, LCD_Code[U8_DisplayThousand]);                    //显示功能区数码管千位
			LCD_SetNumber(SEGMENT_DISPLAYS_7, LCD_Code[U8_DispalyHundred]);                     //显示功能区数码管百位
			LCD_SetNumber(SEGMENT_DISPLAYS_8, LCD_Code[U8_DisplayTen]);                         //显示功能区数码管十位
			LCD_SetNumber(SEGMENT_DISPLAYS_9, LCD_Code[U8_DisplayUnit]);												//显示功能区数码管个位
		}
		BatterySymbolShow();																																	//电池标识显示
		
		if (HandleBarErrorFlag)																																//转把故障
			LCD_COM2_T6_Flag = HIGH_LEVEL;																											//显示转把故障标识
		
		if (MotorHallErrorStateFlag)																													//电机霍尔故障
			LCD_COM3_T5_Flag = HIGH_LEVEL;																											//显示电机霍尔故障标识
		
		if (BrakeStateFlag)																																		//刹车
			LCD_COM3_T4_Flag = HIGH_LEVEL;																											//显示刹车标识
//----------------------------------------------------------------------------------------//
 }
 
 /*****************************************************************************************
 * 函数名		：BatterySymbolShow()
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2018-09-08
 * 函数描述 ：电池图标显示
 ****************************************************************************************/
 void BatterySymbolShow(void)
 {
		unsigned char												u8_battery_cell_number = 0;
		static unsigned char								u8_battery_frame_flash = 0;
	 
		
		LCD_COM1_R1_Flag = LOW_LEVEL;
		LCD_COM2_R2_Flag = LOW_LEVEL;
		LCD_COM3_R3_Flag = LOW_LEVEL;
		LCD_COM3_R4_Flag = LOW_LEVEL;
		LCD_COM2_R5_Flag = LOW_LEVEL;
		LCD_COM1_R6_Flag = LOW_LEVEL;																													//预先清零其他段
		
		if (U8_BatteryCellNumber<VOLTAGE_CELL_1)																							//小于一格电量值
		{
			if ((u8_battery_frame_flash++)>4)																										//电池框闪烁时间调节
			{
				LCD_COM0_R0_Flag = ~LCD_COM0_R0_Flag;	
				u8_battery_frame_flash = 0;
			}
		}
		else
		{
			LCD_COM0_R0_Flag = HIGH_LEVEL;
			LCD_COM1_R1_Flag = HIGH_LEVEL;																											//如果不欠压电池框和最低电量段是永远显示的
			
			if (U8_BatteryCellNumber>VOLTAGE_CELL_5)																						//显示全部的电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;
				LCD_COM2_R5_Flag = HIGH_LEVEL;
				LCD_COM1_R6_Flag = HIGH_LEVEL;							
			}
			else if (U8_BatteryCellNumber>VOLTAGE_CELL_4)																				//显示5个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;
				LCD_COM2_R5_Flag = HIGH_LEVEL;						
			}
			else if (U8_BatteryCellNumber>VOLTAGE_CELL_3)																				//显示4个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;					
			}
			else if (U8_BatteryCellNumber>VOLTAGE_CELL_2)																				//显示3个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;					
			}
			else if (U8_BatteryCellNumber>VOLTAGE_CELL_1)																				//显示2个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;					
			}
		}
		
		
		

	#if 0	
		if (u16_battery_voltage_buffer<U16_LowVoltageValue)																		//小于欠压值
		{
			if ((u8_battery_frame_flash++)>4)																										//电池框闪烁时间调节
			{
				LCD_COM0_R0_Flag = ~LCD_COM0_R0_Flag;	
				u8_battery_frame_flash = 0;
			}
		}
		else
		{
			u8_battery_cell_number = (unsigned char)u16_battery_voltage_buffer-U16_LowVoltageValue;//
			u8_battery_cell_number *= 10;																												//电源电压和欠压差值扩大10倍，这样就不用做浮点运算
			
			u8_battery_cell_number = (unsigned char)u8_battery_cell_number/U8_BatteryCellVoltage;
			
			LCD_COM0_R0_Flag = HIGH_LEVEL;
			LCD_COM1_R1_Flag = HIGH_LEVEL;																											//如果不欠压电池框和最低电量段是永远显示的
			
			if (u8_battery_cell_number>VOLTAGE_CELL_6)																					//显示全部的电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;
				LCD_COM2_R5_Flag = HIGH_LEVEL;
				LCD_COM1_R6_Flag = HIGH_LEVEL;							
			}
			else if (u8_battery_cell_number>VOLTAGE_CELL_5)																			//显示5个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;
				LCD_COM2_R5_Flag = HIGH_LEVEL;						
			}
			else if (u8_battery_cell_number>VOLTAGE_CELL_4)																			//显示4个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;
				LCD_COM3_R4_Flag = HIGH_LEVEL;					
			}
			else if (u8_battery_cell_number>VOLTAGE_CELL_3)																			//显示3个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;
				LCD_COM3_R3_Flag = HIGH_LEVEL;					
			}
			else if (u8_battery_cell_number>VOLTAGE_CELL_2)																			//显示2个电池格
			{
				LCD_COM2_R2_Flag = HIGH_LEVEL;					
			}
		}
		
		#endif 
 }
 
/*****************************************************************************************
 * 函数名		：LCD_SetNumber
 * 输入参数 ：无
 * 输出参数 ：无
 * 返回值  	：无
 * 修改时间 ：2018-09-08
 * 函数描述 ：LCD显示数字设置
 ****************************************************************************************/
void LCD_SetNumber(unsigned char	u8_type, unsigned char 	u8_number) 
{
	switch (u8_type)
	{
		case SEGMENT_DISPLAYS_1:																															//第一个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_1A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_1A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_1B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_1B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_1C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_1C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_1D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_1D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_1E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_1E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_1F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_1F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_1G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_1G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_2:																															//第二个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_2A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_2A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_2B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_2B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_2C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_2C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_2D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_2D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_2E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_2E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_2F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_2F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_2G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_2G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_3:																															//第三个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_3A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_3A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_3B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_3B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_3C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_3C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_3D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_3D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_3E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_3E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_3F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_3F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_3G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_3G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_4:																															//第四个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_4A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_4A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_4B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_4B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_4C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_4C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_4D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_4D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_4E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_4E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_4F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_4F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_4G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_4G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_5:																															//第五个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_5A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_5A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_5B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_5B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_5C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_5C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_5D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_5D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_5E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_5E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_5F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_5F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_5G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_5G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_6:																															//第六个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_6A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_6A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_6B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_6B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_6C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_6C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_6D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_6D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_6E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_6E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_6F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_6F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_6G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_6G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_7:																															//第七个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_7A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_7A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_7B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_7B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_7C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_7C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_7D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_7D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_7E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_7E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_7F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_7F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_7G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_7G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_8:																															//第八个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_8A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_8A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_8B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_8B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_8C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_8C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_8D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_8D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_8E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_8E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_8F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_8F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_8G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_8G_Flag = LOW_LEVEL;
			break;
		}
		case SEGMENT_DISPLAYS_9:																															//第九个数码字显示编码
		{
			if (u8_number&0x01)			LCD_COM0_9A_Flag = HIGH_LEVEL;															//segment_a
			else										LCD_COM0_9A_Flag = LOW_LEVEL;	
			if (u8_number&0x02)			LCD_COM1_9B_Flag = HIGH_LEVEL;															//segment_b
			else										LCD_COM1_9B_Flag = LOW_LEVEL;	
			if (u8_number&0x04)			LCD_COM2_9C_Flag = HIGH_LEVEL;															//segment_c
			else										LCD_COM2_9C_Flag = LOW_LEVEL;	
			if (u8_number&0x08)			LCD_COM3_9D_Flag = HIGH_LEVEL;															//segment_d
			else										LCD_COM3_9D_Flag = LOW_LEVEL;	
			if (u8_number&0x10)			LCD_COM3_9E_Flag = HIGH_LEVEL;															//segment_e
			else										LCD_COM3_9E_Flag = LOW_LEVEL;	
			if (u8_number&0x20)			LCD_COM2_9F_Flag = HIGH_LEVEL;															//segment_f
			else										LCD_COM2_9F_Flag = LOW_LEVEL;	
			if (u8_number&0x40)			LCD_COM1_9G_Flag = HIGH_LEVEL;															//segment_g
			else										LCD_COM1_9G_Flag = LOW_LEVEL;
			break;
		}
	}
}


/**********************SINOWEALTH_SH79F083A**********END OF FILE*************************/
